package com.youqingkuang.ipmsg.net;

public final class IPMSG {

    /* Event Type */
    public final static int IPMSG_EVENT_ENTRY = 0;

    public final static int IPMSG_EVENT_EXIT = 1;

    public final static  int IPMSG_EVENT_MESSAGE = 2;

    public final static  int IPMSG_EVENT_FILE = 3;

    public final static int Last = 4;

    /* header */
    public final static int IPMSG_VERSION = 0x0001;

    public final static int IPMSG_DEFAULT_PORT = 0x0979;

    public final static int IPMSG_USING_PORT = 0x0979;

    /* command */
    public final static int IPMSG_NOOPERATION = 0x00000000;

    public final static int IPMSG_BR_ENTRY = 0x00000001; //

    public final static int IPMSG_BR_EXIT = 0x00000002; //

    public final static int IPMSG_ANSENTRY = 0x00000003;

    public final static int IPMSG_BR_ABSENCE = 0x00000004;

    public final static int IPMSG_BR_ISGETLIST = 0x00000010;

    public final static int IPMSG_OKGETLIST = 0x00000011;

    public final static int IPMSG_GETLIST = 0x00000012;

    public final static int IPMSG_ANSLIST = 0x00000013;

    // public final static int IPMSG_FILE_MTIME = 0x00000014;

    // public final static int IPMSG_FILE_CREATETIME = 0x00000016;

    public final static int IPMSG_BR_ISGETLIST2 = 0x00000018;

    public final static int IPMSG_SENDMSG = 0x00000020; //

    public final static int IPMSG_RECVMSG = 0x00000021;

    public final static int IPMSG_READMSG = 0x00000030;

    public final static int IPMSG_DELMSG = 0x00000031;

    public final static int IPMSG_GETFILEDATA = 0x00000060;

    public final static int IPMSG_RELEASEFILES = 0x00000061;

    public final static int IPMSG_GETDIRFILES = 0x00000062;

    public final static int IPMSG_GETINFO = 0x00000040; //

    public final static int IPMSG_SENDINFO = 0x00000041; //

    public final static int IPMSG_GETABSENCEINFO = 0x00000050;

    public final static int IPMSG_SENDABSENCEINFO = 0x00000051;

    /* option for all command */
    public final static int IPMSG_ABSENCEOPT = 0x00000100;

    public final static int IPMSG_SERVEROPT = 0x00000200;

    public final static int IPMSG_DIALUPOPT = 0x00010000;

    public final static int IPMSG_FILEATTACHOPT = 0x00200000;

    /* option for send command */
    public final static int IPMSG_SENDCHECKOPT = 0x00000100;

    public final static int IPMSG_SECRETOPT = 0x00000200;

    public final static int IPMSG_BROADCASTOPT = 0x00000400;

    public final static int IPMSG_MULTICASTOPT = 0x00000800;

    public final static int IPMSG_NOPOPUPOPT = 0x00001000;

    public final static int IPMSG_AUTORETOPT = 0x00002000;

    public final static int IPMSG_RETRYOPT = 0x00004000;

    public final static int IPMSG_PASSWORDOPT = 0x00008000;

    public final static int IPMSG_NOLOGOPT = 0x00020000;

    public final static int IPMSG_NEWMUTIOPT = 0x00040000;

    public final static int IPMSG_NOADDLISTOPT = 0x00080000;

    /* file types for file attach command */
    public final static int IPMSG_FILE_REGULAR = 0x00000001;

    public final static int IPMSG_FILE_DIR = 0x00000002;

    public final static int IPMSG_FILE_RETPARENT = 0x00000003; // return parent

    // directory

    public final static String HOSTLIST_DELIMIT = "\07"; // "\a"

    public final static String HOSTLIST_DUMMY = "\010"; // "\b"

    public final static String SEPARATOR = ":";

    /* end of IP Messenger Communication Protocol version 1.0 define */

    public final static int IPMSG_FILE_MTIME = 0x00000014;

    public final static int IPMSG_FILE_CREATETIME = 0x00000016;

    /* IP Messenger for Windows internal define */
    public final static int IPMSG_REVERSEICON = 0x0100;

    public final static int IPMSG_TIMERINTERVAL = 4000;

    public final static int IPMSG_CLOCKTICK = 500;

    public final static int IPMSG_GETLIST_FINISH = 0;

    public final static int IPMSG_BROADCAST_TIMER = 0x0101;

    public final static int IPMSG_SEND_TIMER = 0x0102;

    public final static int IPMSG_DELETE_TIMER = 0x0103;

    public final static int IPMSG_LISTGET_TIMER = 0x0104;

    public final static int IPMSG_LISTGETRETRY_TIMER = 0x0105;

    public final static int IPMSG_ENTRY_TIMER = 0x0106;

    public final static int IPMSG_DUMMY_TIMER = 0x0107;

    public final static int IPMSG_RETRY_TIMES = 4;

    public final static int IPMSG_NICKNAME = 1;

    public final static int IPMSG_FULLNAME = 2;

    public final static int IPMSG_NAMESORT = 0x00000000;

    public final static int IPMSG_IPADDRSORT = 0x00000001;

    public final static int IPMSG_HOSTSORT = 0x00000002;

    public final static int IPMSG_NOGROUPSORTOPT = 0x00000100;

    public final static int IPMSG_ICMPSORTOPT = 0x00000200;

    public final static int IPMSG_NOKANJISORTOPT = 0x00000400;

    public final static int IPMSG_ALLREVSORTOPT = 0x00000800;

    public final static int IPMSG_GROUPREVSORTOPT = 0x00001000;

    public final static int IPMSG_SUBREVSORTOPT = 0x00002000;

    public static int MAX_SOCKBUF = 8192;
    static {
        String osname = System.getProperty("os.name").toLowerCase();
        if (osname.indexOf("windows") != -1) MAX_SOCKBUF = 32768;
    }
    public final static int MAX_UDPBUF = 8192;

    public final static int MAX_BUF = 1024;

    public final static int MAX_NAMEBUF = 50;

    public final static int MAX_LANGBUF = 10;

    public final static int MAX_LISTBUF = 200;// (MAX_NAMEBUF * 3 + 50)

    public final static String HS_TOOLS = "HSTools";

    public final static String IP_MSG = "IPMsg";

    public final static String NO_NAME = "no_name";

    public final static String URL_STR = "://";

    public final static String MAILTO_STR = "mailto:";

    public final static String NO_ABSENCE = "Not absence mode";

    public static int GET_MODE(int command) {
        return command & 0x000000ff;
    }

    public static int GET_OPT(int command) {
        return command & 0xffffff00;
    }

}
